<?php
include('./mysql.php');

$result = $conn->query('SELECT * FROM major');

$arr = [];
while($row = $result->fetch_assoc()) {
    $arr[] = $row;
}

echo json_encode(["list"=>$arr]);